import os

p = '/Users/cai/IdeaProjects/flutter/sxw_order/lib'

s = 0


def get_count(f):
    if not f.endswith(".dart"):
        return
    print(f)
    count = open(f, mode='r', encoding='utf8').readlines().__len__()
    global s
    s += count
    print("%s number = %s" % (f, count.__str__()))
    pass


def for_each_path(p: str):
    pathlist = os.listdir(p)
    for pa in pathlist:
        full_path = "%s/%s" % (p, pa)
        if os.path.isdir(full_path):
            for_each_path(full_path)
        elif os.path.isfile(full_path):
            get_count(full_path)
    pass


for_each_path(p)

print("all code line number = %s", str(s))
